<?php
    header("Access-Control-Allow-Origin: *");
    $servername = "localhost";
    $username = "tfsgz";
    $password = "2ZEcT4PW6m8wfEHA";
    $mysqlname = "tfsgz"; 
    $json = '';
    $data = array();
    class User 
    {
    }

    $conn = mysqli_connect($servername, $username, $password, $mysqlname);

    $sql = "SELECT * FROM config";
    $result = $conn->query($sql);

    if($result){
        // echo "查询成功";
        while ($row = mysqli_fetch_array($result,MYSQL_ASSOC))
        {
        $user = new User();
        $user->id = intval($row["id"]);
        $user->keys = $row["keys"];
        $user->values = $row["values"];
        $data[]=$user;
        }
        // $json = json_encode($data);//把数据转换为JSON数据.
        $json = json_encode($data);//把数据转换为JSON数据.
        echo $json;
        }else{
        echo "查询失败";
        }
?>